﻿using System;
using System.Runtime.Serialization;

namespace SSTestAPI
{
    [Serializable]
    public class Flower : Plant, ISerializable
    {
        public bool Symmetric { get; set; }

        public int LeafsQuantity { get; set; }

        public Flower() : base()    
        {
            Symmetric = false;
            LeafsQuantity = 0;
        }

        public Flower(string branch, bool symm, int leafs, int life) : base(branch, life)
        {
            Symmetric = symm;
            LeafsQuantity = leafs;
        }

        public override int getLifetime()
        {
            return lifetime;
        }

		protected Flower(SerializationInfo info, StreamingContext ctxt)
		{
            branch = info.GetString("PlantBranch");
            lifetime = info.GetInt32("PlantLifetime");
            Symmetric = info.GetBoolean("FlowerSymmetric");
            LeafsQuantity = info.GetInt32("FlowerLeafs");
		}

        public virtual void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("PlantBranch", branch);
            info.AddValue("PlantLifetime", lifetime);
            info.AddValue("FlowerSymmetric", Symmetric);
            info.AddValue("FlowerLeafs", LeafsQuantity);
        }
    }
}
